<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
	</head>

	<body style="padding: 0px;">
		<div class="easyui-layout" style="width:100%;height:600px;">
			<div data-options="region:'center'">
				<div>
					<table id="dg" class="table_style">
					</table>
				</div>
			</div>
		</div>
		<div id="toolbar"></div>
		<div id="dlg" class="hiddenDialog">
			<iframe id="ifrmEdit" style="width: 100%;height: 100%;" frameborder="0" scrolling="no"></iframe>
		</div>
	</body>

	<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
	<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../../JS/common.js"></script>
	<script type="text/javascript" src="../../../JS/json2.js"></script>
	<script type="text/javascript" src="../../../JS/finance.js"></script>

	<script type="text/javascript">
		var currid = getID();
		var content = "";
		var DialogWidth = 765;
		var DialogHeight = 290;
		var AddDialog;
		var _url;
		content = AddToolBar(35);
		$("#toolbar").append(content);

		if(currid == AddFlag) {
			_url = RemoteLinkAddress + '/frozen/charge/list.do';
		} else {
			_url = RemoteLinkAddress + '/frozen/charge/list.do?TENANT_ID=' + currid;
		}

		/*添加信息*/
		function newdata() {
			var pLocation = "TenantChargeAdd.html?type=other&id=-1";
			$("#ifrmEdit").attr("src", pLocation);
			constructDialog($("#dlg"), "租户明细账新增", DialogWidth, DialogHeight);
			AddDialog.dialog('open');
		}

		/*编辑信息*/
		function editdata() {
			var pLocation = "";
			var row = $('#dg').datagrid('getSelected');
			if(!row) {
				$.messager.alert('Info', "请选择你需要修改数据");
				return;
			}
			pLocation = "TenantChargeAdd.html?type=other&id=" + row.ID;
			$("#ifrmEdit").attr("src", pLocation);
			constructDialog($("#dlg"), "租户明细账信息", DialogWidth, DialogHeight);
			AddDialog.dialog('open');
		}

		/*还原*/
		function redodata() {
			var _url = RemoteLinkAddress + '/frozen/charge/list.do';
			$.ajax({
				dataType: "json",
				type: "get",
				url: _url,
				success: function(result) {
					if(result != null) {
						var _data = result;
						$('#dg').datagrid('loadData', _data);
					}
				},
				error: function(xhr, status, error) {
					$.messager.alert("错误", "请求失败!");
				}
			});
		}

		function dialogClose() {
			AddDialog.dialog('close');
		}

		$('#dg').datagrid({
			url: _url,
			toolbar: '#toolbar',
			method: 'get',
			pagination: 'true',
			rownumbers: 'true',
			autoRowHeight: 'true',
			fitColumns: 'false',
			singleSelect: 'true',
			height: 350,
			/*表格中的列名以及各自列名的ID*/
			columns: [
				[{
						field: 'ID',
						title: 'ID',
						width: '0%',
						align: 'center'
					}, {
						field: 'TENANT_NO',
						title: '租户编号',
						width: '0%',
						align: 'center'
					},
					{
						field: 'ORDER_NO',
						title: '收费编号',
						width: '10%',
						align: 'center'
					}, {
						field: 'TENANT_NAME',
						title: '租户姓名',
						width: '14%',
						align: 'center'
					}, {
						field: 'CHARGETYPE',
						title: '收费类型',
						width: '8%',
						align: 'center',
						formatter: function(value, row, index) {
							if(value == 0) {
								return "收费";
							}
							if(value == 1) {
								return "退费";
							} else {
								return "充值";
							}
						}
					}, {
						field: 'CHARGENAME',
						title: '费用名称',
						width: '8%',
						align: 'center'
					}, {
						field: 'PAYER',
						title: '缴费人',
						width: '14%',
						align: 'center'
					}, {
						field: 'COST_DATE',
						title: '缴费时间',
						width: '13%',
						align: 'center'
					}, {
						field: 'SUM',
						title: '总金额',
						width: '13%',
						align: 'center',
						formatter: function(value, row, index) {
							if(value) {
								return "￥" + value + "元";
							}
						}
					}, {
						field: 'ISVERIFY',
						title: '审核状态',
						width: '14%',
						align: 'center',
						formatter: function(value, row, index) {
							return verifyStatus(value, false);
						}
					}
				]
			],
			onDblClickRow: function(index, row) {
				var pLocation = "TenantChargeAdd.html?type=other&id=" + row.ID;
				$("#ifrmEdit").attr("src", pLocation);
				constructDialog($("#dlg"), "租户明细账修改", DialogWidth, DialogHeight);
				AddDialog.dialog('open');
			}
		});
		$('#dg').datagrid('hideColumn', 'ID');
		$('#dg').datagrid('hideColumn', 'TENANT_NO');
	</script>

</html>